//
//  URLService.swift
//  SwiftWeather
//
//  Created by shen on 2023/8/28.
//

import Foundation

struct URLService {
    func createURL(scheme: String, host: String, path: String, queryParameters: [String: String]?) -> URL? {
        var urlComponents = URLComponents()
        urlComponents.scheme = scheme
        urlComponents.host = host
        urlComponents.path = path
        urlComponents.queryItems = queryParameters?.map { URLQueryItem(name: $0, value: $1) }
        return urlComponents.url
    }
}
